home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
prgtools
/
gnustuff
/
minix
/
libsrc~1.z
/
libsrc~1
/
rand.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1989-12-28
|
340 b
|
24 lines
#include "lib.h"
static long __seed = 1L;
int rand()
{
__seed = (1103515245L * __seed + 12345) & 0x7FFFFFFF;
#ifdef __GNUC__
#ifdef __MSHORT__
return((int) ((__seed >> 16) & 077777));
#else
return((int) __seed);
#endif
#else
return((int) ((__seed >> 16) & 077777));
#endif
}
void srand(val)
unsigned int val;
{
__seed = val;
}